package netty.net.demo;

import java.util.Random;

public class NettyTestMain {  
	  
    public static void main(String[] args) throws Exception {  
        NettyServer nettyServer = new NettyServer();  
        nettyServer.start();//启动server  
        Thread.sleep(3000);  
  
        NettyClient nettyClient = new NettyClient();  
        nettyClient.start();  
  
        try {  
            for (int i = 0; i < 5; i++) {  
                String response = nettyClient.send(new Random().nextInt(10000) + "");  
                System.out.println("response:" + response);  
            }  
        } catch (Exception e) {  
            e.printStackTrace();  
        } finally {  
            nettyClient.close();  
        }  
  
        nettyServer.close();  
  
    }  
}
